import { User } from '../../user/entities/user.entity';
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm';

@Entity()
export class Model {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  name: string;

  @Column()
  description: string;

  @Column('longtext')
  content: string;

  @Column({default: false})
  default: boolean;

  @Column({default: false})
  deleted: boolean;

  @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
  createdAt: Date;

  @ManyToOne(() => User, user => user.entities)
  user: User;

  // 添加外键列（可选，但推荐）
  @Column({ nullable: true }) // 如果已有数据，先允许为空
  userId: number;
}
